﻿using SigowayCommonLib;
using System;
using System.Collections.Generic;
using System.Linq;

using System.Windows.Forms;
using WarehouseManager.Common;

namespace WarehouseManager
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic);
            Application.ThreadException += Application_ThreadException;

            LoginForm loginForm = new LoginForm();
            // 简洁调用
            if (!SingleInstance.HandleRunningInstance())
            {
                Application.Run(loginForm);
            }
        }

        private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MessageBoxHelp.ShowMsgError("发了未知异常，请关闭程序重新运行即可！");
            LogManager.WriteLine("发了未知异常.\r\nException:" + e.Exception);
        }
    }
}
